package com.caesar.Set;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author caesar
 * @date 2025/7/16
 * @Description:
 * @apiNote
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Employee implements Comparable<Employee>{
    private int id;
    private String name;
    private double salary;
    private int age;

    @Override
    public int compareTo(Employee o) {
        int result = Double.compare(this.salary,o.salary);
        return result != 0 ? result : Integer.compare(this.id,o.id);
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", salary=" + salary +
                ", age=" + age +
                '}';
    }
}
